/**
 * Created by beck on 2015/8/18.
 */
$(document).ready(function(){
	$("#applyfor").click(function() {
		$(".dig").css("display","block");
	});
	$("#take-off").click(function() {
		$(".dig").css("display","none");
	});
	$("#enter").click(function() {
		enterGroup();
	});
    var Post ="mid="+basedata.mid+"&groupid="+basedata.groupid+"&token="+basedata.token+"&did="+commondata.groupinfo;
    $.ajax({
        url:'../api/group/getgroupinfobymid',
        type:'post',
        data:Post,
        success:function(msg){
            if(msg.code==100){
                $("#logo img").attr("src",msg.datum.n0);
                $(".company").text(msg.datum.n1);
                $("#tel").html(msg.datum.n3);
                $("#add").html(msg.datum.n4);
                $("#e_mail").html(msg.datum.n5);
                $("#net").html(msg.datum.n6);
            }
        }
    });
});
function enterGroup() {
	var $name= $("#name").val();
	var $commentcontent =$("#commentcontent").val();
	var $explain = "&mname="+$name+"&joingroupid="+basedata.groupid+"&joincomment="+$commentcontent;
	var Post ="mid="+basedata.mid+"&groupid="+basedata.groupid+"&token="+basedata.token+"&did="+commondata.groupinfo+$explain;
	$.ajax({
		url:'../api/group/applyforjoingroup',
		type:'post',
		data:Post,
		success:function(msg){
			if (msg.code == 100) {
				$(".dig").css("display","none");
			}
		}
	});
}
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}